package com.zone.gateway.core.socket;

import io.netty.channel.Channel;
import io.netty.channel.ChannelHandlerContext;
import io.netty.channel.SimpleChannelInboundHandler;

/**
 * @author: zongzi
 * @description: 自定义处理及基类（用户后续扩展、增强代码阅读性）
 * @date: 2025/4/17
 */
public abstract class BaseHandler<T> extends SimpleChannelInboundHandler<T> {

    @Override
    protected void channelRead0(ChannelHandlerContext channelHandlerContext, T t) throws Exception {
        this.session(channelHandlerContext, channelHandlerContext.channel(), t);
    }


    // 留给子类实现
    protected abstract void session(ChannelHandlerContext ctx, Channel channel, T request);
}
